<%@ page language="java" contentType="text/html; charset=UTF-8" import="java.util.*,SiTuQingYou.vo.*,SiTuQingYou.vo.*"
    pageEncoding="UTF-8"%>
    <%   
String path = request.getContextPath();
%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="<%=path %>/houtai/js/jquery-3.3.1.min.js"></script>
<style type="text/css">
 td{
 mairgin:10px;
 padding:10px;
 }
</style>
</head>
<body> 
      	<table>
      	<tr><td>by</td>
      		<td>评论内容</td>
      		<td>评论时间</td>
      		<td></td>
      		</tr>
    <% 
      ArrayList<Comment> comment =(ArrayList<Comment>)request.getAttribute("comment");
      for(Comment com:comment){  %>
      
      
    	 <tr><td><%=com.getUser().getUseranswer() %></td>
    	  	 <td><%=com.getComment() %></td>
    	  	 <td><%=com.getCommenttime() %></td>
    	  	 <td><input type="button" cid="<%=com.getId() %>"    value="删除"></td></tr>
    	
    	  
    <% } %>
    </table>
    <script type="text/javascript">
    $(document).ready(function(){
    	$("input").click(function(){
    		var cid = $(this).attr("cid");
    		var thiss = $(this);
    		$.ajax({
    			url:"<%=path%>/StratrhomeServlet",
    			type:"post",
    			data:"method=deletecom&cid="+cid,
    			success:function(mes){
    				thiss.parent().parent().remove();
    			}
    		});
    		
    	});
    });
    </script>
    
    
</body>
</html>